{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">文章列表</div>
    <div class="layui-card-body">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li {empty name='Request.param.type'}class="layui-this"{/empty}><a href="{:url('publist',['id'=>$param.id])}">全部</a></li>
                <li {if $Request.param.type==1}class="layui-this"{/if}><a href="{:url('publist',['id'=>$param.id,'type'=>1])}">已采集</a></li>
                <li {if $Request.param.type==2}class="layui-this"{/if}><a href="{:url('publist',['id'=>$param.id,'type'=>2])}">已导入</a></li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form">
                        <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="barTool">
    <a class="layui-btn layui-btn-xs layui-btn-normal layui-iframe" href="{:url('show')}?id={{d.id}}">查看</a>
</script>
{/block}
{block name="script"}
<script>
layui.use('yznTable', function() {
    var table = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        delete_url: '{:url("content_del",["nid"=>$param.id])}',
    };

    table.render({
        init: init,
        toolbar: ['refresh','delete'
            {empty name="Request.param.type"}
            ,[{
                html:'<a class="layui-btn layui-btn-sm layui-btn-warm" confirm data-request="{:url("content_del",["nid"=>$param.id,"type"=>"all"])}" data-table="currentTable">全部清空</a>'
            }]
            {/empty}
            {if $Request.param.type==1}
            ,[{
                html:'<a class="layui-btn layui-btn-sm" href="{:url("program/index",["type"=>"all","id"=>$param.id])}">全部导入</a>'
            }]
            {/if}
        ],
        url: '{:url("publist",$param)}',
        cols: [
            [
                { type: 'checkbox', fixed: 'left' },
                { field: 'status', title: '状态', width: 80,templet: '<div>{{#  if(d.status==1){ }} <button class="layui-btn layui-btn layui-btn-xs">已采集</button> {{#  } else { }} <button class="layui-btn layui-btn-danger layui-btn layui-btn-xs">已导入</button> {{#  } }} </div>' },
                { field: 'title', title: '标题' },
                { field: 'url', title: '网址' },
                { fixed: 'right', width: 80, title: '操作', toolbar: '#barTool' }
            ]
        ],
        page: {}
    });
});
</script>
{/block}